<html>
<head><meta charset="utf-8"><title>Type inference with `iter` · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Type.20inference.20with.20.60iter.60.html">Type inference with `iter`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="189578249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Type%20inference%20with%20%60iter%60/near/189578249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Type.20inference.20with.20.60iter.60.html#189578249">(Mar 03 2020 at 10:07)</a>:</h4>
<p>Is type inference supposed to work with <code>iter</code>? I can't recall. For example, in</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">f</span><span class="p">(</span><span class="n">args</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="kt">i32</span><span class="p">])</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">for</span><span class="w"> </span><span class="n">s</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">args</span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p><code>iter</code> is resolved, but <code>s</code> doesn't have a type.</p>



<a name="189578431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Type%20inference%20with%20%60iter%60/near/189578431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Type.20inference.20with.20.60iter.60.html#189578431">(Mar 03 2020 at 10:09)</a>:</h4>
<p>Might be <a href="https://github.com/rust-analyzer/rust-analyzer/issues/2603" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/2603">https://github.com/rust-analyzer/rust-analyzer/issues/2603</a>.</p>



<a name="189579122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Type%20inference%20with%20%60iter%60/near/189579122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Type.20inference.20with.20.60iter.60.html#189579122">(Mar 03 2020 at 10:19)</a>:</h4>
<p>yes, it probably is <a href="https://github.com/rust-lang/chalk/issues/234" target="_blank" title="https://github.com/rust-lang/chalk/issues/234">rust-lang/chalk#234</a> (at least I won't debug such cases further until that's fixed)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>